<?php

class Core_Controller_Admin_Settings_General extends Controller
{

    public function actionIndex($request, $response)
    {
    }

    public function actionSite($request, $response)
    {
        $response -> form = $form = Agis::getForm('core@admin.settings.general.site');

        if ($request -> isPost() and $form -> isValid($_POST))
        {
            $form -> doCommit();
        }
        
        $response->setScript('module/core/views/admin/settings/general/edit.tpl');
    }

    public function actionCache($request, $response)
    {
        $response -> form = $form = Agis::getForm('core@admin.settings.general.cache');

        if ($request -> isPost() and $form -> isValid($_POST))
        {
            $form -> doCommit();
        }
        $response->setScript('module/core/views/admin/settings/general/edit.tpl');
    }

    public function actionMail($request, $response)
    {
        $response -> form = $form = Agis::getForm('core@admin.settings.general.mail');

        if ($request -> isPost() and $form -> isValid($_POST))
        {
            $form -> doCommit();
        }
        $response->setScript('module/core/views/admin/settings/general/edit.tpl');
    }

    public function actionStage($request, $response)
    {
        $response -> form = $form = Agis::getForm('core@admin.settings.general.stage');

        if ($request -> isPost() and $form -> isValid($_POST))
        {
            $form -> doCommit();
        }
        $response->setScript('module/core/views/admin/settings/general/edit.tpl');
    }

    public function actionSpeed($request, $response)
    {
        $response -> form = $form = Agis::getForm('core@admin.settings.general.speed');


        if ($request -> isPost() and $form -> isValid($_POST))
        {
            $form -> doCommit();
        }
        $response->setScript('module/core/views/admin/settings/general/edit.tpl');
    }

    public function actionSignup($request, $response)
    {
        // Agis::getHelper('core@mail') -> send('core@test-email', 1);
        $response->setScript('module/core/views/admin/settings/general/edit.tpl');
    }

}
